using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SV2Xml {
    public partial class Preferences : Form {
        public Preferences() {
            InitializeComponent();
        }

        private void locateOutputDirectory_Click(object sender, EventArgs e) {
            DialogResult result = this.outputDirectoryBrowser.ShowDialog();
            if (result == DialogResult.OK) {
                this.outputDirectory.Text = this.outputDirectoryBrowser.SelectedPath;

                Program.MainForm.saveAsFileDialog.InitialDirectory = this.outputDirectory.Text;
            }
        }

        private void locateSavedVariablesDirectory_Click(object sender, EventArgs e) {
            DialogResult result = this.savedVariablesDirectoryBrowser.ShowDialog();
            if (result == DialogResult.OK) {
                this.installationDirectory.Text = this.savedVariablesDirectoryBrowser.SelectedPath;

                Program.MainForm.openFileDialog.InitialDirectory = this.installationDirectory.Text;
                Program.MainForm.batchFileOpenDialog.InitialDirectory = this.installationDirectory.Text;
            }
        }

        private void Preferences_FormClosed(object sender, FormClosedEventArgs e) {
            Properties.Settings.Default.ExportPath = this.outputDirectory.Text;
            Properties.Settings.Default.WowSavedVariablesDirectory = this.installationDirectory.Text;
            Properties.Settings.Default.Save();
        }
    }
}